//
//  MyActivityDetailController.m
//  i5db
//
//  Created by iMuse on 15-5-26.
//  Copyright (c) 2015年 mySelf. All rights reserved.
//

#import "MyActivityDetailController.h"
#import "AppCenter.h"
#import "AppButtonView.h"

@interface MyActivityDetailController ()
{
    UIScrollView * scrollview;
    UIView       * contentView;
    
    NSLayoutConstraint * contentHeight;
    NSLayoutConstraint * activityHeight;
}

@end

@implementation MyActivityDetailController

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        self.title = @"聚会详情";
    }
    return self;
}
-(void)updateViewConstraints
{
    [super updateViewConstraints];
    [scrollview autoPinToTopLayoutGuideOfViewController :self withInset:0];
    [scrollview autoPinToBottomLayoutGuideOfViewController:self withInset:0];
    [scrollview autoPinEdgeToSuperviewEdge:ALEdgeLeft withInset:0];
    [scrollview autoPinEdgeToSuperviewEdge:ALEdgeRight withInset:0];
    
    [contentView autoPinEdge:ALEdgeTop toEdge:ALEdgeTop ofView:scrollview withOffset:-64];
    [contentView autoPinEdge:ALEdgeLeft toEdge:ALEdgeLeft ofView:scrollview withOffset:0];
    [contentView autoPinEdge:ALEdgeRight toEdge:ALEdgeRight ofView:scrollview withOffset:0];
    [contentView autoPinEdge:ALEdgeBottom toEdge:ALEdgeBottom ofView:scrollview withOffset:0];
    [contentView autoSetDimension:ALDimensionWidth toSize:SCREEN_WIDTH];
    
}

-(void) initNavigationBar
{
    [super initNavigationBar];
}

- (void)viewDidLoad
{
    [super viewDidLoad];
    [self initNavigationBar];
    [self initView];
}

-(void) initView
{
    scrollview = [UIScrollView newAutoLayoutView];
    scrollview.showsVerticalScrollIndicator = NO;
    [self.view addSubview:scrollview];
    contentView = [UIView newAutoLayoutView];
    [scrollview addSubview:contentView];
    
    
  
    AppButtonView * titleView = [AppButtonView newAutoLayoutView];
    [titleView setLeftText:@"主题"];
    [titleView setRightText:@"一场说走就走的旅行和一袋子不伤手的立白"];
    [titleView hiddenLine];
    [contentView addSubview:titleView];
    [titleView autoPinEdgeToSuperviewEdge:ALEdgeLeft withInset:0];
    [titleView autoPinEdgeToSuperviewEdge:ALEdgeRight withInset:0];
    [titleView autoPinEdgeToSuperviewEdge:ALEdgeTop withInset:10];
    [titleView autoSetDimension:ALDimensionHeight toSize:40];
    
    AppButtonView * startTime = [AppButtonView newAutoLayoutView];
    [startTime setLeftText:@"开始时间"];
    [startTime setRightText:@"2015-12-23 17:00"];
    [contentView addSubview:startTime];
    [startTime autoPinEdge:ALEdgeTop toEdge:ALEdgeBottom ofView:titleView withOffset:10];
    [startTime autoPinEdgeToSuperviewEdge:ALEdgeRight withInset:0];
    [startTime autoPinEdgeToSuperviewEdge:ALEdgeLeft withInset:0];
    [startTime autoSetDimension:ALDimensionHeight toSize:40];
    
    AppButtonView * endTime = [AppButtonView newAutoLayoutView];
    [endTime hiddenLine];
    [endTime setLeftText:@"结束时间"];
    [endTime setRightText:@"2015-12-24 17:00"];
    [contentView addSubview:endTime];
    [endTime autoPinEdge:ALEdgeTop toEdge:ALEdgeBottom ofView:startTime withOffset:0];
    [endTime autoPinEdgeToSuperviewEdge:ALEdgeRight withInset:0];
    [endTime autoPinEdgeToSuperviewEdge:ALEdgeLeft withInset:0];
    [endTime autoSetDimension:ALDimensionHeight toSize:40];
    
    AppButtonView * activityPlace = [AppButtonView newAutoLayoutView];
   
    [activityPlace setLeftText:@"活动地点"];
    [activityPlace setRightText:@"北京欢乐谷"];
    [contentView addSubview:activityPlace];
    [activityPlace autoPinEdge:ALEdgeTop toEdge:ALEdgeBottom ofView:endTime withOffset:10];
    [activityPlace autoPinEdgeToSuperviewEdge:ALEdgeRight withInset:0];
    [activityPlace autoPinEdgeToSuperviewEdge:ALEdgeLeft withInset:0];
    [activityPlace autoSetDimension:ALDimensionHeight toSize:40];
    
    AppButtonView * activityLimit = [AppButtonView newAutoLayoutView];
    [activityLimit hiddenLine];
    [activityLimit setLeftText:@"报名人数"];
    [activityLimit setRightText:@"150"];
    [contentView addSubview:activityLimit];
    [activityLimit autoPinEdge:ALEdgeTop toEdge:ALEdgeBottom ofView:activityPlace withOffset:0];
    [activityLimit autoPinEdgeToSuperviewEdge:ALEdgeRight withInset:0];
    [activityLimit autoPinEdgeToSuperviewEdge:ALEdgeLeft withInset:0];
    [activityLimit autoSetDimension:ALDimensionHeight toSize:40];
    
    UILabel * jieshaoLabel = [UILabel newAutoLayoutView];
    jieshaoLabel.text = @"活动介绍";
    jieshaoLabel.font = [UIFont boldSystemFontOfSize:12];
    [self.view addSubview:jieshaoLabel];
    [jieshaoLabel autoPinEdge:ALEdgeTop toEdge:ALEdgeBottom ofView:activityLimit withOffset:10];
    [jieshaoLabel autoPinEdgeToSuperviewEdge:ALEdgeLeft withInset:10];
    
    
    UILabel * label = [UILabel newAutoLayoutView];
    label.backgroundColor = [UIColor whiteColor];
    [contentView addSubview:label];
    
  UILabel*  activityLabel = [UILabel newAutoLayoutView];
    activityLabel.numberOfLines = 0;
  
    activityLabel.textColor = [AppCenter color:@"126,126,126,1"];
    activityLabel.font = [UIFont systemFontOfSize:13];
    activityLabel.text = @"1、条理一定要清楚，分类要合理，一般包括以下几部分：活动目的、可行性分析、活动内容(这个最重要)、分工(含工作推进)、预算2、活动内容这一块应包含以下几个方面的内容：宣传(包含宣传形式以及宣传日程)报名(又叫参赛方式，含报名时间、报名方式、参赛要求等等)活动形式(这才是真正意义上的活动内容，包括活动分为哪几个环节，每个环节都是些什么内容，如果是体育类比赛就应包含赛程赛制规则等等。)活动流程(这个应从两方面写，一是大流程，即整个活动期间各个环节应该干的事，什么时候宣传，什么时候都是哪个阶段的比赛等等;二是小流程，即正式比赛或活动当天的流程，严格来讲这一部分的流程不应出现工作人员要干的事情，而只出现活动相关的内容，类似于晚会节目单，只出现观众和比赛人员应知道的流程。一般情况给外人看的策划只出现小流程)评奖(含奖项设置、评奖办法、平分细则等等),注意事项(具体活动具体分析)3、分工要按照“工种”给工作人员分类，同时著名各项工作完成时限(这一块一定要细，要责任到人)4、预算要合理(实地考查)、有周转空间、同时应学会“该花的不能吝啬，该省的一定要省”5、如果是要拉赞助的活动一定要单独做赞助邀请6、策划的语言一定要精炼、书面化，不能罗嗦或是出现大白话7、策划要讲求格式统一，该空行的地方统一空行，包括行间距、字体大小、缩进度都得保持一样，这样才清楚整齐。";
    
    activityLabel.backgroundColor = [UIColor clearColor];
    [contentView addSubview:activityLabel];
    [activityLabel autoPinEdge:ALEdgeTop toEdge:ALEdgeBottom ofView:jieshaoLabel withOffset:5];
    [activityLabel autoPinEdgeToSuperviewEdge:ALEdgeLeft withInset:10];
    [activityLabel autoPinEdgeToSuperviewEdge:ALEdgeRight withInset:10];
    
    CGSize size = [AppCenter sizeWithString:activityLabel.text font:activityLabel.font maxHeight:2000 maxWeight:SCREEN_HEIGHT];
    
     [contentView autoSetDimension:ALDimensionHeight toSize:SCREEN_HEIGHT+size.height];
    

    [label autoPinEdge:ALEdgeTop toEdge:ALEdgeTop ofView:activityLabel withOffset:0];
    [label autoPinEdgeToSuperviewEdge:ALEdgeLeft withInset:0];
    [label autoPinEdgeToSuperviewEdge:ALEdgeRight withInset:0];
    [label autoPinEdge:ALEdgeBottom toEdge:ALEdgeBottom ofView:activityLabel withOffset:0];
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}


- (void)viewWillAppear:(BOOL)animated {
    
    
    [[self rdv_tabBarController] setTabBarHidden:YES animated:NO];
    [super viewWillAppear:animated];
    
    
}


- (void)viewWillDisappear:(BOOL)animated {
    
    [[self rdv_tabBarController] setTabBarHidden:NO animated:NO];
    
    [super viewWillDisappear:animated];
}





@end
